<?php

	function _icon($identifier, $path, $title=null, $alternateText=null) {
		$filename = null;
		switch($identifier) {
			case 'add':
				$filename = 'add2.png';
				break;
			case 'view':
				$filename = 'view.png';
				break;
			case 'delete':
			case 'del':
				$filename = 'delete2.png';
				break;
			case 'edit':
				$filename = 'edit.png';
				break;
		}
		if(is_null($filename)) {
			// TODO: react on invalid file identifier
		}
		if(is_null($alternateText)) {
			$alternateText = $title;
		}
		$tag = '<img src="/images/'.$path.'/'.$filename.'" alt="'.sfWidget::escapeOnce($alternateText).'" title="'.sfWidget::escapeOnce($title).'" />';
		return $tag;
	}
	
	function _icon16($identifier, $title=null, $alternateText=null) {
		return _icon($identifier, '16', $title, $alternateText);
	}
	
	function _icon24($identifier, $title=null, $alternateText=null) {
		return _icon($identifier, '24', $title, $alternateText);
	}
	
	function icon($identifier, $size, $title=null, $alternateText=null) {
		switch($size) {
			case 16:
				return _icon16($identifier, $title, $alternateText);
				break;
			case 24:
				return _icon24($identifier, $title, $alternateText);
				break;
		}
	}
	
?>